﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Calendar : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!Page.IsPostBack)
        //{
        //    DropDownList1.Items.Clear();
        //    for (int i = 0; i <= 50; i++)
        //    {
        //        DropDownList1.Items.Add("-" + i.ToString());
        //    }
        //}
    }
    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        if (Request.QueryString["DialogClientID"] != String.Empty)
        {
            string lClientID = Request["DialogClientID"].ToString().Trim();
            System.Text.StringBuilder lJScript = new System.Text.StringBuilder("");
            lJScript.Append("window.opener.document.getElementById('" + lClientID + "').value='" + this.Calendar1.SelectedDate.ToString("yyyy/MM/dd") + "';");
            lJScript.Append("window.close();");
            ClientScript.RegisterStartupScript(this.GetType(), "ReturnValue", lJScript.ToString(), true);
        }
    }
}